package com.boot.security.server.dao.user;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.user.TswUsreWallet;

@Mapper
public interface TswUsreWalletDao {

    @Select("select * from tsw_usre_wallet t where t.id = #{id}")
    TswUsreWallet getById(Long id);

    @Delete("delete from tsw_usre_wallet where id = #{id}")
    int delete(Long id);

    int update(TswUsreWallet tswUsreWallet);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_usre_wallet(user_id, cash_reserve, settled_amount, outstanding_amount, withdrawal_amount, wing_balance, settled_sycee, outstanding_sycee, total_consumption, consumption_number, rebate_wing, cash_rebates, spending_cash, consumption_wing, wallet_note, wallet_remark) values(#{userId}, #{cashReserve}, #{settledAmount}, #{outstandingAmount}, #{withdrawalAmount}, #{wingBalance}, #{settledSycee}, #{outstandingSycee}, #{totalConsumption}, #{consumptionNumber}, #{rebateWing}, #{cashRebates}, #{spendingCash}, #{consumptionWing}, #{walletNote}, #{walletRemark})")
    int save(TswUsreWallet tswUsreWallet);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswUsreWallet> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
